<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <script>
        function Person(name) {
            this.name = name;
        }

        Person.prototype = {
            constructor: Person,
            say: function() {
                console.log(this.name);
            }
        }

        // 函数的第一种调用方式：函数调用方式
        Person("abc"); // 直接调用Person()函数，函数内部的this指向window

        var age = 18;
        var p = {
            age: 15,
            say: function(){
                console.log(this.age);
            }
        }

        var f1 = p.say;
        // 函数调用方式  内部的this指向window
        f1(); // 结果打印 18
    </script>
</body>
</html>